﻿
using Bankeren.Engine;
using Caliburn.Micro;
namespace BankerenClient
{
    public class PlayerViewModel : PropertyChangedBase
    {
        #region Fields

        private string name;
        private string nameColor;
        private Avatar avatar;
        private int tricksBid;
        private int tricksTaken;
        private bool isDealer;
        private bool hasTurn;

        #endregion

        #region Properties

        public string Name
        {
            get { return this.name; }
            set
            {
                this.name = value;
                NotifyOfPropertyChange(() => Name);
            }
        }

        public string NameColor
        {
            get { return this.nameColor; }
            set
            {
                this.nameColor = value;
                NotifyOfPropertyChange(() => NameColor);
            }
        }

        public Avatar Avatar
        {
            get { return this.avatar; }
            set
            {
                this.avatar = value;
                NotifyOfPropertyChange(() => Avatar);
            }
        }

        public PlayerInfo Info
        {
            get
            {
                return new PlayerInfo(this.Name, this.NameColor, this.Avatar);
            }
            set
            {
                this.Name = value.Name;
                this.NameColor = value.NameColor;
                this.Avatar = value.Avatar;
            }
        }

        public int TricksBid
        {
            get { return this.tricksBid; }
            set
            {
                this.tricksBid = value;
                NotifyOfPropertyChange(() => TricksBid);
            }
        }

        public int TricksTaken
        {
            get { return this.tricksTaken; }
            set
            {
                this.tricksTaken = value;
                NotifyOfPropertyChange(() => TricksTaken);
            }
        }

        public bool IsDealer
        {
            get { return this.isDealer; }
            set
            {
                this.isDealer = value;
                NotifyOfPropertyChange(() => IsDealer);
            }
        }

        public bool HasTurn
        {
            get { return this.hasTurn; }
            set
            {
                this.hasTurn = value;
                NotifyOfPropertyChange(() => HasTurn);
            }
        }

        #endregion

        #region Ctor

        public PlayerViewModel()
        {
            this.name = "Player";
            this.nameColor = "#FFFFFF";
            this.avatar = new Avatar("chicken");
            this.tricksBid = 0;
            this.tricksTaken = 0;
            this.isDealer = false;
            this.hasTurn = false;
        }

        #endregion
    }
}
